package com.sc.nft.admin.controller;

import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dto.BindPermissionsToTheProductMenuDTO;
import com.sc.nft.dto.IdRequest;
import com.sc.nft.feign.MerchantRoleMenuClient;
import com.sc.nft.sup.Result;
import com.sc.nft.vo.ProductMenuListVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 产品绑定菜单列表(MerchantRoleMenu)表控制层
 *
 * @author wwc
 * @since 2023-03-28 11:05:28
 */

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("admin/merchantRoleMenu")
@Api(tags = "产品绑定菜单列表")
public class MerchantRoleMenuController {

    /**
     * 服务对象
     *
     */
    private final MerchantRoleMenuClient merchantRoleMenuClient;


    @PostMapping(value = "bindPermissionsToTheProductMenu", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "给产品绑定权限菜单", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public Result bindPermissionsToTheProductMenu(@RequestBody BindPermissionsToTheProductMenuDTO bindPermissionsToTheProductMenuDTO) {
        merchantRoleMenuClient.bindPermissionsToTheProductMenu(bindPermissionsToTheProductMenuDTO);
        return Result.success();
    }

    @PostMapping(value = "productPermissionMenuList", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "获取产品菜单列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    public Result<List<ProductMenuListVO>> productPermissionMenuList(@RequestBody IdRequest idRequest) {
        return merchantRoleMenuClient.productPermissionMenuList(idRequest);
    }
}
